Skip to content

Remove old ADCSTemplate.zip references and add new templates - #340

Open
Ne0nd0g wants to merge 6 commits into
dreadnode:mainfrom
Ne0nd0g:fix/adcs-zip
Open

Remove old ADCSTemplate.zip references and add new templates#340
Ne0nd0g wants to merge 6 commits into
dreadnode:mainfrom
Ne0nd0g:fix/adcs-zip

Conversation

@Ne0nd0g

@Ne0nd0g Ne0nd0g commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the required ADCSTemplate.zip files to the two ADCS-related Ansible roles and removes their entries from .gitignore so the templates are included in the repository and available during provisioning.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would change existing behavior)
  • New lab, lab variant, or extension
  • New / updated provider support
  • Refactor / internal cleanup (no functional change)
  • Documentation
  • CI / build / release tooling
  • Dependency update

Area

  • CLI (cli/)
  • Ansible collection (ansible/)
  • Terraform / Terragrunt (infra/, modules/)
  • Packer / Warpgate (packer/, warpgate-templates/)
  • Lab definitions (ad/)
  • Extensions (extensions/)
  • Variant generator / tools (tools/)
  • Documentation (docs/, README.md, etc.)
  • CI workflows (.github/)

Related issues

No related issue.

How was this tested?

Verified that the updated ADCSTemplate.zip files are present at the paths expected by both Ansible roles:

  • ansible/roles/adcs_templates/files/ADCSTemplate.zip

  • ansible/roles/vulns_adcs_templates/files/ADCSTemplate.zip

  • Provider(s) tested: Not tested

  • Lab(s) tested: Not tested

  • Operator OS: macOS

Screenshots / logs (optional)

Not applicable.

Checklist

  • I have read CONTRIBUTING.md.
  • My changes follow the existing code style of the area I touched.
  • I have added or updated tests where it makes sense (Go tests under cli/, Ansible syntax checks, etc.).
  • I have updated documentation (README, docs/, role README, command help text) where relevant.
  • I have checked that I am not committing real secrets, personal credentials, or internal hostnames. (Intentional lab credentials inside ad/, ansible/, and extensions/ are expected and fine.)
  • If this PR changes user-facing CLI behavior, I have updated the relevant --help text and any docs that reference it.
  • If this PR introduces a breaking change, I have called it out in the Summary above.

@dreadnode-renovate-bot dreadnode-renovate-bot Bot added the area/roles Changes made to Ansible roles label Jul 10, 2026
@mkultraWasHere

Copy link
Copy Markdown
Contributor

Hey @Ne0nd0g — thanks for catching this. The fix works, but wanted to suggest an alternative that avoids committing binary zips.

The unzipped ADCSTemplate/ directory is already tracked in git (both roles have it at files/ADCSTemplate/). Instead of committing the zip, we could replace the 3-task zip workflow (copy → extract → cleanup) with a single win_copy directory copy:

- name: Copy ADCSTemplate module to remote
  ansible.windows.win_copy:
    src: files/ADCSTemplate/
    dest: "C:\\Program Files\\WindowsPowerShell\\Modules\\ADCSTemplate\\"

I compared the zip contents against the tracked directory — they're identical (same 10 files). PowerShell modules are just directories of .psm1/.psd1 files with no special packaging, so win_copy of the directory works the same as extract-from-zip.

Benefits:

  • No binary blobs in git (zips don't diff, bloat the repo permanently)
  • No stale zip risk if someone updates a .psm1 in the directory but forgets to re-zip
  • Fewer Ansible tasks (3 → 1)

Do you see any issues with that approach? If not, happy to update the PR branch — or feel free to adjust it yourself.

@mkultraWasHere mkultraWasHere self-assigned this Jul 26, 2026
@Ne0nd0g

Ne0nd0g commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, I agree with your approach, I'll try to get an update to my PR pushed soon

Replace the copy-zip / Expand-Archive / cleanup sequence in the
adcs_templates and vulns_adcs_templates roles with a single win_copy of
the already-tracked files/ADCSTemplate/ directory, and drop the
committed ADCSTemplate.zip blobs.

A PowerShell module is just a directory of .psm1/.psd1 files, so the
copy produces the same layout Expand-Archive did. The zip contents were
byte-identical to the tracked directory in both roles.

Also removes the now-dead zip plumbing this makes redundant:

- PrepareADCSZips (provision preflight was its only caller)
- the `zip` doctor check and its mention in `doctor --help`
- the Ludus docs zip prerequisite and its troubleshooting section

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dreadnode-renovate-bot dreadnode-renovate-bot Bot added the area/docs Changes made to documentation label Aug 5, 2026
@mkultraWasHere

mkultraWasHere commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@Ne0nd0g — I went ahead and pushed the change we discussed to this branch (6812177) so it's not sitting on you. Entirely up to you to review and approve; happy to revert or rework any of it.

The agreed change

Both roles (adcs_templates, vulns_adcs_templates) now do a single directory copy instead of copy-zip → Expand-Archive → cleanup:

- name: Copy ADCSTemplate module to remote
  ansible.windows.win_copy:
    src: files/ADCSTemplate/
    dest: "C:\\Program Files\\WindowsPowerShell\\Modules\\ADCSTemplate\\"

Both ADCSTemplate.zip blobs are removed. Before deleting them I extracted each and diffed against the tracked files/ADCSTemplate/ directory — byte-identical in both roles, so nothing is lost. Your .gitignore removal stays correct: nothing generates those zips anymore.

A little more than we agreed on — flagging explicitly since it's your PR

Dropping the zips made some existing plumbing dead, so I removed it in the same commit:

  • PrepareADCSZips() in cli/internal/ansible/prepare.go — provision preflight was its only caller
  • the zip doctor check (cli/internal/doctor/checks.go) and its mention in doctor --helpPrepareADCSZips was the only thing that shelled out to zip
  • the Ludus docs zip prerequisite, plus an "ADCS template zip missing" troubleshooting section that referenced a cert_templates.zip path no longer present in the repo

Say the word if you'd rather keep this PR to just the role change and split the cleanup out.

Verification

  • Built the collection (ansible-galaxy collection build) and confirmed all 15 ADCSTemplate/ entries ship in the tarball for both roles — worth noting since preflight built the collection before PrepareADCSZips ran, so on a fresh clone the first-run collection never actually contained the zip. The tracked directory removes that ordering trap.
  • Exercised the same _find_needle('files', src) + trailing-slash walk that win_copy uses against a mirrored role layout: resolves role-relative, lands ADCSTemplate/ADCSTemplate.psd1 at the module root (so Import-Module ADCSTemplate in vulns_adcs_esc15 still resolves), output identical to the source tree, idempotent on re-run.
  • go build / go vet / gofmt / full go test ./... clean; docsible regenerated both role READMEs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Changes made to documentation area/roles Changes made to Ansible roles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants